<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>상품등록</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$("#regis").click(function() {

			var productName = $(":text[name=productName]").val();
			var productPrice = $(":text[name=productPrice]").val();
			var productMaker= $(":text[name=productMaker]").val();
			var productInfo= $(":text[name=productInfo]").val();
			var productTitle=$(":text[name=productTitle]").val();
			var sellerId=$(":text[name=sellerId]").val();
			if (productName == "") {
				alert("상품명을 입력하세요!");
				return false;
			}
			else if (productPrice == "") {
				alert("가격을 입력하세요!");
				return false;
			}
			else if (isNaN($("#productPrice").val())){
				alert("가격을 숫자로 입력하세요!");
				return false;
			}
			
			else if (productMaker == "") {
				alert("제조사를 입력하세요!");
				return false;
			}
			else if (productInfo == "") {
				alert("상품정보를 등록하세요!");
				return false;
			}
			else if (productTitle == "") {
				alert("상품 제목을 입력하세요!");
				return false;
			}
			else if (sellerId == "") {
				alert("판매자 id를  입력하세요!");
				return false;
			}
			
		
			alert("상품 등록이 되었습니다");
			$("#registerProduct").submit();
	
		});
	});
</script>
</head>
<body>
	* 상품등록 *
	<hr>

	<form
	 method="post" action="product.do" id="registerProduct"  enctype="multipart/form-data"  >
<!-- enctype="multipart/form-data" -->
<center>
		상품명 : <input type="text" name="productName"><br> 
		가격 : <input type="text" name="productPrice" id="productPrice"><br>
		제조사 : <input type="text" name="productMaker"><br> 
		상품정보 : <input type="text" name="productInfo"><br> 
		타이틀 : <input type="text" name="productTitle"><br> 
		판매자 ID: <input type="text" name="sellerId"><br> 
		
		<input type="hidden" name="productCategory"   value="${requestScope.productCategory }">
		 <!--  이미지 등록 버튼  -->
		<input type="file" name="uploadFile">
		 <input type="button" id="regis" value="상품등록">
		
</center>
	</form>

</body>
</html>